package hacker_rank.ai;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BotsSavePrincess2 {

	static void nextMove(int n, int mx, int my, String[] grid) {
		int px, py;
		px = py = -1;

		int j = -1;
		for (int i = 0; i < n; i++) {
			j = grid[i].indexOf("p");
			if (j >= 0) {
				px = i;
				py = j;
			}
		}
	//	System.out.printf("m: (%d, %d), p: (%d, %d)\n", mx, my, px, py);
		if ((px - mx) > 0)
			System.out.println("DOWN");
		else if ((mx - px) > 0)
			System.out.println("UP");
		else if ((my - py) > 0)
			System.out.println("LEFT");
		else if ((py - my) > 0)
			System.out.println("RIGHT");
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n, r, c;
		n = Integer.parseInt(br.readLine());

		String line;

		line = br.readLine();
		r = Integer.parseInt(line.split(" ")[0]);
		c = Integer.parseInt(line.split(" ")[1]);

		// System.out.printf("r = %d, c = %d\n", r, c);
		String grid[] = new String[n];

		for (int i = 0; i < n; i++) {
			grid[i] = br.readLine();
		}

		nextMove(n, r, c, grid);

	}
}
